package com.qiang;

import java.io.*;
import java.util.UUID;

public class Demo05 {
    public static void main(String[] args) throws IOException {

        //读取bb里面所有的图片全部复制到ee里面
        File f1 = new File("D:\\ee");
        f1.mkdirs();
        File f2 = new File("D:\\bb");
        //获取f2的文件列表
        File[] f3 = f2.listFiles();
        for (File f4 : f3) {
            if (f4.isFile()) {
                //是图片的话，就读取
                //String abs = f4.getAbsolutePath();//获取f4的绝对路径
                String abs = f4.getPath();
                //System.out.println(abs);
                BufferedInputStream bis = new BufferedInputStream(new FileInputStream(abs));
                byte[] bb = new byte[1024];
                int len;
                BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("D:\\ee\\" + UUID.randomUUID().toString() + ".jpg"));
                while ((len = bis.read(bb)) != -1) {
                    bos.write(bb, 0, len);
                }
                bis.close();
                bos.close();
            }
        }


    }
}
